package com.hdax.dmw.scheduler.mapstruct;

import com.hdax.dmw.entity.scheduler.SchedulerSeatPrice;
import com.hdax.dmw.scheduler.dtos.SchedulerDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

@Mapper(componentModel = "spring")
public abstract class SeatPriceMapper {

    public String getAreaLevelName(Integer areaLevel){
        if(areaLevel == 1){
            return "A";
        }else if(areaLevel == 2){
            return "B";
        }else {
            return "C";
        }
    }

    @Mappings({
            @Mapping(target = "areaLevelName",expression = "java(getAreaLevelName(source.getAreaLevel()))")
    })
    public abstract SchedulerDto.SeatPrice toTarget(SchedulerSeatPrice source);
    public abstract List<SchedulerDto.SeatPrice> toTargetList(List<SchedulerSeatPrice> sources);
}
